from binn import *
from binn_obj import BinnObj
from binn_list import BinnList
from binn_iter import BinnIter
class P(object):
    def __init__(self, name ,i ,f):
        self.name = name
        self.i = i
        self.f = f
    def to_binn(self):
        o = BinnObj()
        o.set_str("name", self.name)
        o.set_int32("i", self.i)
        o.set_float("f", self.f)
        return o
    @staticmethod
    def from_binn(o):
        name = o.get_str("name")
        i = o.get_int32("i")
        f = o.get_float("f")
        return P(name, i, f)

    def __str__(self):
        return "{} {} {}".format(self.name, self.i, self.f)
from encoder import *
from decoder import *
d = {1: [1, 2], 2 : 1}
#l = [12.3, 3, [12.2, 10]]
o = encode(d)
ll = decode(o)
print(ll)
#it = lo.begin()
#while it.next():
#    print(it.get_value())
#p = P("abc", 1, 3.14)
#pb = p.to_binn()
#opb = BinnObj()
#libp = ct.CDLL("libprint.so")
#
#libp.proc(ct.c_voidp(pb.binn), ct.c_voidp(opb.binn))
#op = P.from_binn(opb)
#print(op)

#while it.next():
#    print(it.get_value())

